"""
魔术方法
"""
class Student:
    def __init__(self, name, age):
        self.name = name
        self.age = age
    def __str__(self):
        return f"Student(name={self.name}, age={self.age})"
    #
    def __repr__(self):
        return f"Student('{self.name}', {self.age})"

    def __eq__(self, other):
        if isinstance(other, Student):
            return self.name == other.name and self.age == other.age
        return False
    # 小于号 <
    def __lt__(self, other):
        return self.age < other.age
    # 小于等于 <=
    def __le__(self, other):
        return self.age <= other.age
stu1 = Student("张大帅",20)
print(stu1)  # 自动调用 __str__ 方法
stu2 = Student("张大帅",20)
print(stu1 == stu2)